package com.axc.gallery2.function;

import android.graphics.Bitmap;

import com.axc.gallery2.edit.color.ToBlaWhite;
import com.axc.gallery2.edit.effective.ToBrightCirle;
import com.axc.gallery2.edit.effective.ToNegativeFilm;
import com.axc.gallery2.edit.effective.ToOldColorEffect;
import com.axc.gallery2.edit.effective.ToOverLay;
import com.axc.gallery2.edit.effective.ToRectangelFrame;
import com.axc.gallery2.edit.effective.ToReflection;
import com.axc.gallery2.edit.effective.ToRelievo;
import com.axc.gallery2.edit.effective.ToSharpen;
import com.axc.gallery2.edit.roate.ToRoate90;



public class FunctionAdapter {
	private Bitmap mBitmap = null;
	IsetImage image = null;
	IPicEdit1 picEdit1;
	IPicEdit2 picEdit2;
	IPicEdit2f picEdit2f;
	IPicEdit3 IPicEdit3;
	IPicEdit4iif picEdit4iif;
	IPicEdit5 picEdit5;
	IOverLay picEditOverLay;
	ISaveChange picSaveChange;

	public Bitmap getBitmap() {
		return this.mBitmap;
	}

	public FunctionAdapter(IsetImage img, ISaveChange isave) {
		image = img;
		picSaveChange = isave;
	}

	public FunctionAdapter(ISaveChange isave) {
		picSaveChange = isave;
	}

	public void ProcessImage(IPicEdit1 i) {
		this.picEdit1 = i;
	}

	public void ProcessImage(IPicEdit2 i) {
		this.picEdit2 = i;
	}

	public void ProcessImage(IPicEdit2f i) {
		this.picEdit2f = i;
	}

	public void ProcessImage(IPicEdit3 i) {
		this.IPicEdit3 = i;
	}

	public void ProcessImage(IPicEdit4iif i) {
		this.picEdit4iif = i;
	}

	public void ProcessImage(IPicEdit5 i) {
		this.picEdit5 = i;
	}
	public void ProcessImage(IOverLay overLay){
		this.picEditOverLay=overLay;
	}
	public void setImage(Bitmap bitmap,Bitmap bitmapOverLay){
		mBitmap = picEditOverLay.ProcessWork(bitmap,bitmapOverLay);
		picSaveChange.SaveChange();
		image.SetImageview();
	}

	public void setImage(Bitmap bitmap) {
		mBitmap = picEdit1.ProcessWork(bitmap);
		picSaveChange.SaveChange();
		image.SetImageview();
	}

	public void setImage(Bitmap bitmap, int num) {
		mBitmap = picEdit2.ProcessWork(bitmap, num); 
		picSaveChange.SaveChange();
		image.SetImageview();
	}

	public void setImage(Bitmap bitmap, float num) {
		mBitmap = picEdit2f.ProcessWork(bitmap, num);
		picSaveChange.SaveChange();
		image.SetImageview();
		
	}

	public void setImage(Bitmap bitmap, int w, int h) {
		mBitmap = IPicEdit3.ProcessImage(bitmap, w, h);
	}

	public void setImage(Bitmap bitmap, int x, int y, float r) {
		mBitmap = picEdit4iif.ProcessWork(bitmap, x, y, r);
		picSaveChange.SaveChange();
		image.SetImageview(); 
	}

	public void setImage(Bitmap bm, int flag, float mHueValue,
			float mSaturationValue, float mLumValue) {
		mBitmap = picEdit5.ProcessWork(bm, flag, mHueValue, mSaturationValue,
				mLumValue);
		picSaveChange.SaveChange();
		image.SetImageview();
	
	}

	// new
	// 旋转
	public void ImgRoate90(ToRoate90 roate) {
		this.picEdit2f = roate;
	}

	public void setImgRoate90(Bitmap bitmap, float num) {
		setImage(bitmap, num);
	}

	// 黑白
	public void ImgBlackWhite(ToBlaWhite bw) {
		this.picEdit2 = bw;
	}

	public void setImgToBlackWhite(Bitmap bitmap, int num) {
		setImage(bitmap, num);
	}

	// 倒影
	public void ImgReflection(ToReflection rf) {
		this.picEdit1 = rf;
	}

	public void setImgToReflection(Bitmap bitmap) {
		setImage(bitmap);
	}

	// 锐化
	public void ImgSharpen(ToSharpen sharp) {
		this.picEdit1 = sharp;
	}

	public void setSharpen(Bitmap bitmap) {
		setImage(bitmap);
	}

	// 浮雕
	public void ImgRelievo(ToRelievo re) {
		this.picEdit1 = re;
	}

	public void setRelievo(Bitmap bitmap) {
		setImage(bitmap);
	}

	// 负片
	public void ImgNegativeFile(ToNegativeFilm negative) {
		this.picEdit1 = negative;
	}

	public void setNegativeFile(Bitmap bitmap) {
		setImage(bitmap);
	}

	// 复古效果
	public void ImgOldColEff(ToOldColorEffect oldeff) {
		this.picEdit1 = oldeff;
	}

	public void setOldColEffective(Bitmap bitmap) {
		setImage(bitmap);
	}

	// 矩形相框
	public void ImgRectangleFrame(ToRectangelFrame rect) {
		this.picEdit2f = rect;
	}

	public void setRectangleFrame(Bitmap bitmap, float num) {
		setImage(bitmap, num);
	}

	// 变色
	public void ImgSpecialColor(ToBlaWhite changecol) {
		this.picEdit2 = changecol;
	}

	public void setSpecilColor(Bitmap bitmap, int num) {
		setImage(bitmap, num);
	}

	// 光晕效果
	public void ImgBrightCircle(ToBrightCirle brightCirle) {
		this.picEdit4iif = brightCirle;
	}

	public void setBrightCircle(Bitmap bitmap, int x, int y, float r) {
		setImage(bitmap, x, y, r);
	}
	//叠加
	public void ImgOverLay(ToOverLay overLay) {
		this.picEditOverLay = overLay;
	}

	public void setOverLay(Bitmap bitmap,Bitmap bitmapOverLay) {
		setImage(bitmap, bitmapOverLay);
	}
}
